package com.faxsun.core.order.domain;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.Table;

import org.broadleafcommerce.common.admin.domain.AdminMainEntity;
import org.broadleafcommerce.common.extensibility.jpa.copy.DirectCopyTransform;
import org.broadleafcommerce.common.extensibility.jpa.copy.DirectCopyTransformMember;
import org.broadleafcommerce.common.extensibility.jpa.copy.DirectCopyTransformTypes;
import org.broadleafcommerce.common.presentation.AdminPresentation;
import org.broadleafcommerce.common.presentation.AdminPresentationClass;
import org.broadleafcommerce.common.presentation.PopulateToOneFieldsEnum;
import org.broadleafcommerce.common.presentation.client.SupportedFieldType;
import org.broadleafcommerce.common.presentation.override.AdminPresentationMergeEntry;
import org.broadleafcommerce.common.presentation.override.AdminPresentationMergeOverride;
import org.broadleafcommerce.common.presentation.override.AdminPresentationMergeOverrides;
import org.broadleafcommerce.common.presentation.override.PropertyType;
import org.broadleafcommerce.core.order.domain.FulfillmentGroupImpl;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

@Entity
@Inheritance(strategy = InheritanceType.JOINED)
@Cache(usage=CacheConcurrencyStrategy.NONSTRICT_READ_WRITE, region="blOrderElements")
@Table(name = "FS_BLC_FULFILLMENT_GROUP")
@AdminPresentationMergeOverrides({
		@AdminPresentationMergeOverride(name = "", mergeEntries = @AdminPresentationMergeEntry(propertyType = PropertyType.AdminPresentation.READONLY, booleanOverrideValue = false)),
		@AdminPresentationMergeOverride(name = "currency", mergeEntries = @AdminPresentationMergeEntry(propertyType = PropertyType.AdminPresentation.PROMINENT, booleanOverrideValue = false)),
		@AdminPresentationMergeOverride(name = "personalMessage", mergeEntries = {
				@AdminPresentationMergeEntry(propertyType = PropertyType.AdminPresentation.TAB, overrideValue = FulfillmentGroupImpl.Presentation.Tab.Name.Advanced),
				@AdminPresentationMergeEntry(propertyType = PropertyType.AdminPresentation.TABORDER, intOverrideValue = FulfillmentGroupImpl.Presentation.Tab.Order.Advanced) }),
		@AdminPresentationMergeOverride(name = "address", mergeEntries = {
				@AdminPresentationMergeEntry(propertyType = PropertyType.AdminPresentation.TAB, overrideValue = FulfillmentGroupImpl.Presentation.Tab.Name.Address),
				@AdminPresentationMergeEntry(propertyType = PropertyType.AdminPresentation.TABORDER, intOverrideValue = FulfillmentGroupImpl.Presentation.Tab.Order.Address) }),
		@AdminPresentationMergeOverride(name = "address.isDefault", mergeEntries = { @AdminPresentationMergeEntry(propertyType = PropertyType.AdminPresentation.EXCLUDED, booleanOverrideValue = true) }),
		@AdminPresentationMergeOverride(name = "address.isActive", mergeEntries = { @AdminPresentationMergeEntry(propertyType = PropertyType.AdminPresentation.EXCLUDED, booleanOverrideValue = true) }),
		@AdminPresentationMergeOverride(name = "address.isBusiness", mergeEntries = { @AdminPresentationMergeEntry(propertyType = PropertyType.AdminPresentation.EXCLUDED, booleanOverrideValue = true) }),
		@AdminPresentationMergeOverride(name = "phone", mergeEntries = { @AdminPresentationMergeEntry(propertyType = PropertyType.AdminPresentation.EXCLUDED, booleanOverrideValue = true) }),
		@AdminPresentationMergeOverride(name = "phone.phoneNumber", mergeEntries = {
				@AdminPresentationMergeEntry(propertyType = PropertyType.AdminPresentation.EXCLUDED, booleanOverrideValue = false),
				@AdminPresentationMergeEntry(propertyType = PropertyType.AdminPresentation.ORDER, intOverrideValue = FulfillmentGroupImpl.Presentation.FieldOrder.PHONE),
				@AdminPresentationMergeEntry(propertyType = PropertyType.AdminPresentation.GROUP, overrideValue = "General"),
				@AdminPresentationMergeEntry(propertyType = PropertyType.AdminPresentation.REQUIREDOVERRIDE, overrideValue = "NOT_REQUIRED") }) })
@AdminPresentationClass(populateToOneFields = PopulateToOneFieldsEnum.TRUE, friendlyName = "FulfillmentGroupImpl_baseFulfillmentGroup", ceilingDisplayEntity = "org.broadleafcommerce.core.order.domain.FulfillmentGroup")
@DirectCopyTransform({
    @DirectCopyTransformMember(templateTokens = DirectCopyTransformTypes.MULTITENANT_SITE)
})
public class FSFulfillmentGroupImpl extends FulfillmentGroupImpl implements
		AdminMainEntity {

	/**
	 * 
	 */
	private static final long serialVersionUID = 7098484397451787714L;

	@Column(name = "FS_SHIPPING_URL_BROAD")
	@AdminPresentation(friendlyName = "FulfillmentGroupImpl_Sale_Shipping_QueryBroad", order = 1000, group = "Shipping_Info", groupOrder = 3000, tab = "快递信息", tabOrder = 6000, fieldType = SupportedFieldType.STRING)
	protected String urlBroad;

	@Column(name = "FS_SHIPPING_REF_BROAD")
	@AdminPresentation(friendlyName = "FulfillmentGroupImpl_Sale_Shipping_ReferenceBroad", order = 2000, group = "Shipping_Info", groupOrder = 3000, tab = "快递信息", tabOrder = 6000, fieldType = SupportedFieldType.STRING)
	protected String shippingNumberBroad;
	
	@Column(name = "FS_SHIPPING_URL_CROSS")
	@AdminPresentation(friendlyName = "FulfillmentGroupImpl_Sale_Shipping_QueryCross", order = 3000, group = "Shipping_Info", groupOrder = 3000, tab = "快递信息", tabOrder = 6000, fieldType = SupportedFieldType.STRING)
	protected String urlCross;

	@Column(name = "FS_SHIPPING_REF_CROSS")
	@AdminPresentation(friendlyName = "FulfillmentGroupImpl_Sale_Shipping_ReferenceCross", order = 4000, group = "Shipping_Info", groupOrder = 3000, tab = "快递信息", tabOrder = 6000, fieldType = SupportedFieldType.STRING)
	protected String shippingNumberCross;
	
	@Column(name = "FS_SHIPPING_URL_DOME")
	@AdminPresentation(friendlyName = "FulfillmentGroupImpl_Sale_Shipping_QueryDome", order = 5000, group = "Shipping_Info", groupOrder = 3000, tab = "快递信息", tabOrder = 6000, fieldType = SupportedFieldType.STRING)
	protected String urlDomestic;

	@Column(name = "FS_SHIPPING_REF_DOME")
	@AdminPresentation(friendlyName = "FulfillmentGroupImpl_Sale_Shipping_ReferenceDome", order = 6000, group = "Shipping_Info", groupOrder = 3000, tab = "快递信息", tabOrder = 6000, fieldType = SupportedFieldType.STRING)
	protected String shippingNumberDomestic;


	@Override
	public String getMainEntityName() {
		return this.urlBroad+"|"+this.shippingNumberBroad;
	}


	public String getUrlBroad() {
		return urlBroad;
	}


	public void setUrlBroad(String urlBroad) {
		this.urlBroad = urlBroad;
	}


	public String getShippingNumberBroad() {
		return shippingNumberBroad;
	}


	public void setShippingNumberBroad(String shippingNumberBroad) {
		this.shippingNumberBroad = shippingNumberBroad;
	}


	public String getUrlCross() {
		return urlCross;
	}


	public void setUrlCross(String urlCross) {
		this.urlCross = urlCross;
	}


	public String getShippingNumberCross() {
		return shippingNumberCross;
	}


	public void setShippingNumberCross(String shippingNumberCross) {
		this.shippingNumberCross = shippingNumberCross;
	}


	public String getUrlDomestic() {
		return urlDomestic;
	}


	public void setUrlDomestic(String urlDomestic) {
		this.urlDomestic = urlDomestic;
	}


	public String getShippingNumberDomestic() {
		return shippingNumberDomestic;
	}


	public void setShippingNumberDomestic(String shippingNumberDomestic) {
		this.shippingNumberDomestic = shippingNumberDomestic;
	}

	
}
